package com.cy.bfzcommons.pojo.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


import java.util.ArrayList;

@EnableSwagger2
@Configuration
public class SwaggerConfig {
    //该分组环境生产中不会显示
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                //.enable(b)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.bfz.web.controller"))
                .paths(PathSelectors.any())
                .build().groupName("庄子斌");
    }

    @Bean
    public Docket createRestApi1() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo1())
                //.enable(false)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.bfz.web.controller"))
                .paths(PathSelectors.any())
                .build().groupName("赵永鑫");
    }

    @Bean
    public Docket createRestApi2() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo2())
                //.enable(false)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.bfz.web.vuecontroller"))
                .paths(PathSelectors.any())
                .build().groupName("梁永聪");
    }

    @Bean
    public Docket createRestApi3() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo3())
                //.enable(false)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.bfz.web.controller"))
                .paths(PathSelectors.any())
                .build().groupName("许程南");
    }

    //配置swagger信息
    private ApiInfo apiInfo() {
        //作者信息
        Contact contact = new Contact("庄子斌", "null", "343337065@qq.com");
        return new ApiInfo(
                "包袱斋",
                "二手网",
                "v1.01",
                "https://localhost:8080",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<>());
    }
    //配置swagger信息
    private ApiInfo apiInfo1() {
        //作者信息
        Contact contact = new Contact("梁永聪", "https://www.huaweijr.com", "2213593288@qq.com");
        return new ApiInfo(
                "包袱斋",
                "二手网",
                "v1.01",
                "https://localhost:8080",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<>());
    }

    //配置swagger信息
    private ApiInfo apiInfo2() {
        //作者信息
        Contact contact = new Contact("许程南", "https://www.huaweijr.com", "2213593288@qq.com");
        return new ApiInfo(
                "包袱斋",
                "二手网",
                "v1.01",
                "https://localhost:8080",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<>());
    }

    //配置swagger信息
    private ApiInfo apiInfo3() {
        //作者信息
        Contact contact = new Contact("赵永鑫", "https://www.huaweijr.com", "2213593288@qq.com");
        return new ApiInfo(
                "包袱斋",
                "二手网",
                "v1.01",
                "https://localhost:8080",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<>());
    }

    /*private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("服务:发布为daocke镜像,权限管理，用户管理，页面管理，日志 后台 APIs")
                .description("服务:发布为daocke镜像,权限管理，用户管理，页面管理，日志 后台")
                .termsOfServiceUrl("")
                .contact("程序猿")
                .version("1.0")
                .build();
    }*/


}
